//
//  MHCHHotelNameView.m
//  Go!
//
//  Created by rimi on 16/7/14.
//  Copyright © 2016年 凌风. All rights reserved.
//

#import "MHCHHotelNameView.h"

@interface MHCHHotelNameView ()
@property (nonatomic, strong) UILabel_Font * hotelNameLable;
@property (nonatomic, strong) UITextField * hotelNameTextfield;
@property (nonatomic, strong) UIButton *sureBtn;
@property (nonatomic, strong) UIButton *cancelBtn;

@end

@implementation MHCHHotelNameView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = ColorWith(253, 196, 116);
        [self initializeDataSource];
        [self initializeUserInterface];
    }
    return self;
}

-(void)initializeDataSource/**< 初始化数据源 */{
    
}

-(void)initializeUserInterface/**< 初始化用户界面 */{
    [self addSubview:self.hotelNameLable];
    [self addSubview:self.hotelNameTextfield];
    [self addSubview:self.sureBtn];
    [self addSubview:self.cancelBtn];
}


#pragma mark - 点击事件

-(void)respondsTosureBtn{
    NSLog(@"sure");
    if (_delegate && [_delegate respondsToSelector:@selector(backTheHotelNameForputin:)] && self.hotelNameTextfield.text != nil) {
        [_delegate backTheHotelNameForputin:self.hotelNameTextfield.text];
    }
}

-(void)respondsTocancelBtn{
    NSLog(@"cancel");
}


#pragma mark - Get

- (UILabel_Font *)hotelNameLable{
    if (!_hotelNameLable) {
        _hotelNameLable = [[UILabel_Font alloc]initWithFrame:CGRectMake(0, 0, self.bounds.size.width, Size_H(20))];
        _hotelNameLable.text = @"请输入酒店名";
        _hotelNameLable.font = [UIFont systemFontOfSize:Font(15)];
        _hotelNameLable.textAlignment = NSTextAlignmentCenter;
    }
    return _hotelNameLable;
}

- (UITextField *)hotelNameTextfield{
    if (!_hotelNameTextfield) {
        _hotelNameTextfield = [[UITextField alloc]initWithFrame:CGRectMake(self.bounds.size.width*0.1, Size_H(30),self.bounds.size.width-self.bounds.size.width*0.2, Size_H(25))];
        _hotelNameTextfield.borderStyle = UITextBorderStyleRoundedRect;
        _hotelNameTextfield.layer.borderWidth = 1;
        _hotelNameTextfield.layer.borderColor = [UIColor blackColor].CGColor;
        _hotelNameTextfield.placeholder = @"     请输入:酒店名";
        
    }
    return _hotelNameTextfield;
}

- (UIButton *)sureBtn{
    if (!_sureBtn) {
        _sureBtn = [[UIButton alloc]initWithFrame:CGRectMake(self.bounds.size.width*0.1, Size_H(65),Size_W(80), Size_H(25))];
        [_sureBtn setTitle:@"确定" forState:UIControlStateNormal];
        _sureBtn.backgroundColor = [UIColor orangeColor];
        _sureBtn.layer.cornerRadius = 10;
        [_sureBtn addTarget:self action:@selector(respondsTosureBtn) forControlEvents:UIControlEventTouchUpInside];
    }
    return _sureBtn;
}

- (UIButton *)cancelBtn{
    if (!_cancelBtn) {
        _cancelBtn = [[UIButton alloc]initWithFrame:CGRectMake(self.bounds.size.width*0.6, Size_H(65),Size_W(80), Size_H(25))];
        [_cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
        [_cancelBtn addTarget:self action:@selector(respondsTocancelBtn) forControlEvents:UIControlEventTouchUpInside];
        _cancelBtn.layer.cornerRadius = 10;
        _cancelBtn.backgroundColor = [UIColor orangeColor];
    }
    return _cancelBtn;
}



@end
